home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / control / error < prev    next >
Encoding:
Text File  |  1992-12-17  |  2.1 KB  |  39 lines

  1.           error message ?info? ?code?
  2.                Returns  a  TCL_ERROR  code,   which   causes   command
  3.                interpretation to be unwound.  Message is a string that
  4.                is returned to the application to  indicate  what  went
  5.                wrong.
  6.  
  7.                If the info argument is provided and is  non-empty,  it
  8.                is  used  to  initialize the global variable errorInfo.
  9.                errorInfo is used to accumulate a stack trace  of  what
  10.                was  in  progress  when  an  error  occurred; as nested
  11.                commands unwind, the Tcl interpreter  adds  information
  12.                to  errorInfo.   If the info argument is present, it is
  13.                used to initialize errorInfo and the first increment of
  14.                unwind  information  will  not  be  added  by  the  Tcl
  15.                interpreter.  In other words,  the  command  containing
  16.                the  error command will not appear in errorInfo; in its
  17.                place will be info.  This feature  is  most  useful  in
  18.                conjunction  with  the catch command: if a caught error
  19.                cannot be handled successfully, info  can  be  used  to
  20.                return  a  stack trace reflecting the original point of
  21.                occurrence of the error:
  22.  
  23.                     catch {...} errMsg
  24.                     set savedInfo $errorInfo
  25.                     ...
  26.                     error $errMsg $savedInfo
  27.  
  28.  
  29.                If the code argument is  present,  then  its  value  is
  30.                stored in the errorCode global variable.  This variable
  31.                is intended to hold a machine-readable  description  of
  32.                the error in cases where such information is available;
  33.                see  the   section   BUILT-IN   VARIABLES   below   for
  34.                information  on the proper format for the variable.  If
  35.                the code argument is not  present,  then  errorCode  is
  36.                automatically  reset to ``NONE'' by the Tcl interpreter
  37.                as part  of  processing  the  error  generated  by  the
  38.                command.
  39.